|
|
|
| |
|
|
|
|
You have a number of ODBC-type connection options with Visual Basic 5. In many cases, it is easier to use RDOs/RDC (for Visual Basic 5 Enterprise users) or the ODBCDirect options of the standard data control. This material is included here for those who want direct access to the ODBC interface via Visual Basic code instead of by using the object and ActiveX interfaces. |
|
|
|
|
|
|
|
|
|
|
In today's lesson, you look at installing the ODBC Administrator on your system and using the Administrator program to define and register an ODBC data source for use with the ODBC API. You also briefly examine the ODBC operational model and the minimum ODBC APIs you need to create your own database programs using the ODBC interface. |
|
|
|
|
|
|
|
|
You then use your knowledge of the ODBC API to construct an ActiveX DLL library that contains the essential API calls and a series of wrapper routines that you can use with all your Visual Basic programs to create data-entry screens for ODBC data sources. Finally, you build a Visual Basic data-entry form that calls the library routines and shows you how to implement a simple data-entry form by using standard Visual Basic controls. |
|
|
|
|
|
|
|
|
When you complete this lesson, you will know how to register new data sources by using the ODBC Administrator program. You also will have a code library you can use to build solid Visual Basic applications that bypass the Microsoft Jet engine and use the ODBC API set to read and write databases. |
|
|
|
|
|
|
|
|
Understanding the ODBC Interface |
|
|
|
|
|
|
|
|
The ODBC interface is a direct interface between your Visual Basic program and the target database. This interface was developed by Microsoft as a way to provide seamless access to external data formats. The first versions of ODBC were a bit buggy and, in some cases, slow. Although the ODBC interface now is one of the fastest data interfaces available, many programmers still mistakenly think the ODBC interface is too slow for production applications. This is not the case. As you'll see in today's lesson, using the ODBC interface usually is faster than using the Microsoft Jet database engine. |
|
|
|
|
|
|
|
|
When you use the Microsoft Jet interface to access an ODBC data source, the Microsoft Jet interface does the talking to the ODBC interface, which then talks to the intermediate driver, which talks to the data source your Visual Basic program requested. When you use ODBC API calls, you bypass the Microsoft Jet layer, and your Visual Basic program talks directly to the ODBC interface. Figure 19.1 shows how this process looks on paper. |
|
|
|
|
|